#ifndef _TIMER_H_
#define _TIMER_H_

#include <functional>

namespace SEngine
{
    class Timer
    {
    public:
        Timer();
        virtual ~Timer();
        void SetOneShot(bool isOneShot) { m_isOneShot = isOneShot; }
        void Run(int ms, std::function<void(void)> && fn, bool isOneShot = true);
        void Release();
        static void Update(int delta);
    private:
        bool m_isOneShot;
        int m_currentTime{0};
        int m_timeOut;
        std::function<void(void)> m_timeOutCb;
        inline static std::vector<Timer *> s_timers;
    };
} // namespace SEngine


#endif